Template.friend_card.helpers({
  info: function () {
    return Template.instance().data.friend.info;
  },
  getEmail: function () {
    return Template.instance().data.friend.info.emails[0].address;
  }
});

Template.friend_card.events({
  'click .send-message' (e, instance) {
    Session.set('class.messages.chatroomFriendId', instance.data.friend.friend_id);
    Session.set('class.messages.modalContent', 'messages_chatroom');
    $('#message-modal').modal();
  },

  'click .delete-friend' (e, instance) {
    Session.set('class.deleteModal.title', '确定删除好友？这会同时删除你的私信记录。');
    Session.set('class.deleteModal.type', 'delete-friend');
    Session.set('class.deleteModal.id', instance.data.friend.friend_id);
    $('#delete-modal').modal();
  },
});